package com.lucky.xyt.core.base.service;


import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Lists;

/**
 * Service基类
 * @author lb
 * @version 2018-4-8
 */
@Transactional(readOnly = true)
public abstract class BaseService {
	
	
	@Autowired
	private SqlSession sqlSession;
	
	protected List queryForList(String nameSpace,String sqlID,Object params){
		return sqlSession.selectList(nameSpace+"."+sqlID, params);
	}
	
	protected int insert(String nameSpace,String sqlID,Object params){
		return sqlSession.insert(nameSpace+"."+sqlID, params);
	}
	
	protected int update(String nameSpace,String sqlID,Object params){
		return sqlSession.update(nameSpace+"."+sqlID, params);
	}
	
	protected int delete(String nameSpace,String sqlID,Object params){
		return sqlSession.delete(nameSpace+"."+sqlID, params);
	}
	/**
	 * 日志对象
	 */
	protected Logger logger = LoggerFactory.getLogger(getClass());

}
